﻿// Separate the construction of a complex object from its representation 
// so that the same construction process can create different representations. 

// 一个复杂对象”的创建工作，其通常由各个部分的子对象用一定的算法构成；
// 由于需求的变化，这个复杂对象的各个部分经常面临着剧烈的变化，但是将它们组合在一起的算法确相对稳定。steps的算法稳定
// 如何应对这种变化？如何提供一种“封装机制”来隔离出“复杂对象的各个部分”的变化，从而保持系统中的“稳定构建算法”不随着需求改变而改变？这就是建造者模式


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RealWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            VehicleBuilder builder;

            // Create shop with vehicle builders
            Shop shop = new Shop();

            // Construct and display vehicles
            builder = new ScooterBuilder();
            shop.Construct(builder);
            builder.vehicleObj.Show();

            builder = new CarBuilder();
            shop.Construct(builder);
            builder.vehicleObj.Show();

            builder = new MotorCycleBuilder();
            shop.Construct(builder);
            builder.vehicleObj.Show();
            
            // Wait for user
            Console.ReadKey();

        }
    }
}
